<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of portletimgloader
 *
 * @author EADeveloper
 */
class portletimgloader implements EaSoftPortlet {

    public $image;
    public $height = 100;
    public $width = 200;
    public $includePath;
    public $db;
    public $imagesFolder = "img/";
    public $instanceKey;

    public function showMe() {
        include $this->includePath . "viewimageloader.php";
    }

    public function dispatchRequest() {
        //echo $this->imagesFolder . $this->image;
        $thumb = new P4A_Thumbnail_Generator();
        $thumb->setCacheDir($this->imagesFolder)
                ->setFilename($this->imagesFolder . $this->image)
                ->setMaxWidth($this->width)
                ->setMaxHeight($this->height)
                ->processFile()
                ->outputThumbnail();
    }

    public function requestUrl() {
        return RELATIVE_PATH . CORE_PATH . "?portlet=" . $this->instanceKey;
    }

}

?>
